import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';
import 'package:flutter_douban/model/user_model.dart';
import 'package:flutter_douban/tool_views/cached_network_Image.dart';

class AuthorTopView extends StatefulWidget {
  final UserModel model;

  const AuthorTopView({Key? key,required this.model}) : super(key: key);

  @override
  _AuthorTopViewState createState() => _AuthorTopViewState();
}

class _AuthorTopViewState extends State<AuthorTopView> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      margin: EdgeInsets.only(left: 40,top: MediaQuery.of(context).padding.top,right: 15),
      height: kToolbarHeight,
      child:Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          _iconWidget(),
          Image.asset(
            'assets/images/common/navi_item_more.png',
            width: 24,
            height: 24,
          ),
        ],
      ),
    );
  }

  Widget _iconWidget(){
    return Row(
      children: [
        IconImage(
            url:
            widget.model.p!,
            width: 34,
            height: 34,
            radius: 17,
            borderWidth: 1,
            borderColor: Colors.transparent),
        SizedBox(width: 8,),
        Text(
          widget.model.n!,
          maxLines: 1,
          overflow: TextOverflow.ellipsis,
          style: TextStyle(
            fontSize: 14,
            color: AppColors.black,
          ),
        ),
        SizedBox(width: 60,),
        SizedBox(
          width: 60,
          height: 30,
          child: TextButton(
            onPressed: () => print(''),
            child: Text(
              '关注',
              style: TextStyle(
                color: Colors.black,
                fontSize: 12,
                fontWeight: FontWeight.bold,
              ),
            ),
            // color: Colors.amber,
            // shape: RoundedRectangleBorder(
            //     side: BorderSide(
            //       color: Colors.amber,
            //       width: 0.5,
            //     ),
            //     borderRadius: BorderRadius.circular(15)),
          ),
        ),
        SizedBox(width: 8,),
        Image.asset(
          'assets/images/common/button_search_gray.png',
          width: 20,
          height: 20,
          color: Colors.black,
        ),
      ],
    );
  }

}
